<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>${_front_title}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/static/favicon.ico"/>
    <link rel="stylesheet" href="/static/front/fonts/iconfont.css">
    <link rel="stylesheet" href="/static/front/css/base_new.css">
    <link rel="stylesheet" href="/static/front/css/library.css">
    <link rel="stylesheet" href="/static/front/css/style.css">
    <script src="/static/front/js/jquery-1.11.1.min.js"></script>
	<script src="/static/front/js/jquery.countdown.js"></script>
    <script src="/static/front/js/js.js"></script>
    
     <style type="text/css">
       .investment .quick_screen{display:inline;}
       .investment .quick_screen:after{display:block;content:'';overflow:hidden;width:0;height:0;celar:both;}
       .investment .quick_screen span{margin-top:12px;margin-left:25px;}
       .investment .screen ul li{float:left;margin:8px 8px;}
       .investment .screen ul li a{display:inline;padding:3px 10px;}
       .investment .screen ul li a.current{background:#6DBD45;color:#fff;}
       .investment .screen ul li a:hover{background:#6DBD45;color:#fff;}
       
       .Tab .Tab-shuaixuan{float:right;margin-top:-40px;cursor:pointer;width: 78px;height: 25px;border: #4db0c2 1px solid;background: #5dc0d2;color: #fff;border-radius: 3px;-webkit-border-radius: 3px;-moz-border-radius: 3px;
    	-ms-border-radius: 3px;text-align: center;behavior: url(plugIn/PIE.htc);line-height:25px;}
   		
   		.investment .quick_sxtj{margin-left:20px;}
   		.investment .quick_sxtj ul.clearfix li{font-size:12px;}
   		.investment .quick_sxtj ul.clearfix li input{border:1px solid #ccc;height:25px;}
   		.investment .quick_sxtj ul.clearfix li .quick_btn{width:50px;height:27px;border: #4db0c2 1px solid;background: #5dc0d2;color: #fff;border-radius: 3px;-webkit-border-radius: 3px;
   		-moz-border-radius: 3px;-ms-border-radius: 3px;text-align: center;behavior: url(plugIn/PIE.htc);line-height:26px;cursor:pointer;margin-left:20px;}
   		#amount{background:url();}
   		
		.btn-submit {
			cursor: pointer;
		    padding: 10px 114px;
		    width: 175px;
		    height: 35px;
		    margin-left: -235px;
		    border: #4db0c2 1px solid;
		    background: #5dc0d2;
		    color: #fff;
		    border-radius: 3px;
		    -webkit-border-radius: 3px;
		    -moz-border-radius: 3px;
		    -ms-border-radius: 3px;
		    text-align: center;
		    line-height: 35px;
		}   		
      </style>
</head>

<body>

    <div class="content">
    <#include "../base/top.ftl" />
    <div id="myInvestmentMain" class="cnt clearfix layoutMain">
       <#include "base1.ftl" />
     
        <div class="investment fr">
            <h2>我要提现</h2>
            <div class="Tab" style="margin-top: 48px;">
                <span data="withdraw" class="TabOne tableTab <#if type?? && type=='withdraw'>active</#if>">我要提现</span>
                <span data="records" class="TabTwo tableTab <#if type?? && type=='records'>active</#if>">提现记录</span>
              	<#if type?? && type=='withdraw'>
                 <table class="tabLibrary receivables" border="0" cellspacing="0" cellpadding="0" style='margin-top: 0px;display:block;'>
                    <tbody style='display:block;'>
                    	<tr class="clearfix" style='border:1px solid #dfdfdf;background:#F2F5FA; display:block;width:100%;'>
                    		<td style='width: 295px;border:none;float:left;'>账号总额：
                    			<span>￥
	                        		<em >
	                                	<#if account?? & account.totalAmount??>
	                                		<#if (account.totalAmount != 0 )>
		                                		${account.totalAmount?string('0.00')}
		                                	<#else>
		                                	 	0.00
		                                	</#if>
	                                	</#if>  
									</em>
									元
                        		</span>
                    		</td>
                    		<td style='width: 295px;border:none;float:left;'>可用余额：
                    			<span style='color:red;'>￥
	                    			<em style='color:red;'>
	                                	<#if account?? & account.balance??>
	                                		<#if (account.balance != 0 )>
		                                		${account.balance?string('0.00')}
		                                	<#else>
		                                	 	0.00
		                                	</#if>
				                    	</#if>  
					                 </em>元
					        	</span>
                    		</td>
                    		<td style='width: 295px;border:none;float:left;'>当月免费提现笔数：<span><em>${count}</em>笔</span></td>
                    	<tr>
                    	<tr style='display:block;border:1px solid #dfdfdf;'>
	                    	<td style='display:block;border:none;width:100%;padding-left:300px;'>
	                    		<form action="" class="userFrom">
				                    <div class="picCodePhone clearfix FU">
				                        <label for="picCodePhone" class="fl">验证码：</label>
				                        <input type="text" id="picCode" style="line-height:35px;" class="fl code" style='height:38px;'>
				                        <span class="verificationCode fl" style='left:245px;top:-2px;width:100px;'>
				                        	<img src="/admin/captcha" id="imgCode" title="点击刷新" width="100px" height="38px" onclick="javascript:this.src='/admin/captcha?'+new Date()*1" style="cursor:pointer;">
				                        </span>
				                    </div>
				
				                    <div class="ID clearfix FU" >
				                        <label for="ID" class="fl">提现金额：</label>
				                        <input type="text" id="amount" style="width:130px;line-height:35px;" class="fl" onkeyup="this.value=this.value.replace(/\D/g,'')">
				                    </div>
				                                        
				                    <span class="btn-submit">提交</span>
				                </form>
	                    	</td>
                    	</tr>
                    	<tr>
                    		<td style='border:none;text-align:left;height:32px;line-height:32px;'>
	                    		<em style='color:red;'>注意事项：</em> <br>
				                1、超过当月免提现笔数，将按每笔2元收取手续费。 <br>
				                2、提现金额不能小于100元 <br>
				                3、我们将在1至3个工作日(国家节假日除外)之内将钱转入您网站上填写的提现银行帐号。 <br>
                    		</td>
                    	</tr>
                    </tbody>
                </table>
                </#if>
                <#if type?? && type=='records'>
                <span class='Tab-shuaixuan'>快速筛选</span>
                <div class="screen" style="width:100%;height:0px;overflow:hidden;">
                	<div class="quick_screen" style="width:100%;height:45px">
                		<span class='fl'>筛选时间段：</span>
                	</div>
                	<div class='quick_sxtj'>
                		<ul class="clearfix">
                            <li>
                                <input type="text" id="publishTimeBegin1" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:'readOnly'})" placeholder="请选择开始时间" value="<#if publishTimeBegin?exists>${publishTimeBegin}</#if>">&nbsp;&nbsp; 到&nbsp;&nbsp;
                                <input type="text" id="publishTimeEnd1" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:'readOnly'})" value="" placeholder="请选择结束时间" value="<#if publishTimeEnd?exists>${publishTimeEnd}</#if>">
                            </li>
                            <li>
                                <input type="button" class='quick_btn' value="搜 索" id="search">
                            </li>
                        </ul>
                	</div>
                </div>
                <script>
	             	var h = $('.screen').height();
	             	if(h==0){
	             		$('.screen').css('border','none')
	             	};
	              	$('.Tab-shuaixuan').click(function(){
	              		var h = $('.screen').height();
	              		if(h==0){
	              			$('.screen').css({
	              				'borderTop':'1px dashed #ccc',
	              			}).animate({
	              				height:45
	              			});
	              		}else{
	              			$('.screen').animate({
	              				height:0
	              			},function(){
	              				$('.screen').css('borderTop','none');
	              			});
	              		};
	              	});
			       <#if (publishTimeBegin?exists && publishTimeBegin != '') || (publishTimeEnd?exists && publishTimeEnd != '') >
						$(".Tab-shuaixuan").click();
					</#if>
			      </script>
                <table class="tabLibrary receivables" border="0" cellspacing="0" cellpadding="0" style='margin-top: 0px;display:block;'>
                    <tbody style='display:block;'>
	                    <tr class="clearfix">
	                        <th class="one" style="text-align:center;float:left;width:198px;">提现时间</th>
	                        <th class="two" style="text-align:center;float:left;width:130px;">提现总额（元）</th>
	                        <th class="three" style="text-align:center;float:left;width:130px;">到账金额（元）</th>
	                        <th class="four" style="text-align:center;float:left;width:130px;">手续费（元）</th>
	                        <th class="four" style="text-align:center;float:left;width:130px;">提现银行</th>
	                        <th class="four" style="text-align:center;float:left;width:130px;">提现卡号</th>
	                        <th class="five" style="text-align:center;float:left;width:130px;">状态</th>
	                    </tr>
                   			<#if ((pageInfo?exists) & (pageInfo.pageList?size>0))>
                        		<#list pageInfo.pageList as model>
				                    <tr class="clearfix">
				                        <td class="one" style="text-align:center;float:left;width:198px;">
				                        	<#if model.createTime?exists>${model.createTime?string("yyyy-MM-dd HH:mm:ss")}</#if>
				                        </td>
				                        <td class="two" style="float:left;width:130px">
				                           	 ￥<#if model.money?exists>${model.money?string(",##0.00")}</#if>
				                        </td>
				                        <td class="three" style="float:left;width:130px">
											￥<#if model.balance?exists>${model.balance?string(",##0.00")}</#if>
				                        </td>
				                        <td class="four" style="float:left;width:130px">
				                        	￥<#if model.fee?exists>${model.fee?string(",##0.00")}</#if>
			                        	</td>
				                        <td class="four" style="float:left;width:130px">
				                        	<!--<#if bank?exists>${bank.name}</#if>-->
				                        	<#if model.bankName?exists>${model.bankName}</#if>
			                        	</td>
				                        <td class="four" style="float:left;width:130px">
				                        	<#if model.cardNo?exists>${model.cardNo}</#if>
			                        	</td>			                        				                        	
				                        <td class="five" style="float:left;width:130px">
				                        	<#if (model.status?exists) & (model.status =="success")>提现成功
				                        	
				                        	<#elseif (model.status?exists) & (model.status =="apply")>未提交
				                        	</#if>
				                        </td>
				                    </tr>
			                    </#list>
			                <#else>
			                	<tr style='display:block;'><td rowspan="6" style="display: block;width:100%;height:30px;">暂无数据</td></tr>
		                    </#if>
                	</tbody>
                </table>
                </#if>
            </div>
            <!-- 分页组件 -->
           <#if (pageInfo??) & (pageInfo.pageList?size>0)>
            	<div class="tcdPageCode"></div>
            </#if>
        </div>
    </div>
    
	<div id="footer">
	    <div class="content">
			<#include "../base/foot.ftl" />
	    </div>
	</div>
</div>

<script type="text/javascript" src="${_front_js}/jquery.page.js"></script>
<script type="text/javascript" src="${_front_js}/tabs.js"></script>
<script type="text/javascript" src="${_front_js}/date.js"></script>
<script type="text/javascript" src="${_front_js}/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${_front_js}/layer/layer.js" ></script>
<script>
	<#if type?? && type=='records'>
		$(".tcdPageCode").createPage({
	        pageCount:${pageInfo.pages},//总页数
	        current:${pageInfo.index},
	        backFn:function(index){
	            window.location.href="/account/withdraw?type=${type}&publishTimeBegin=<#if publishTimeBegin?exists>${publishTimeBegin}</#if>&publishTimeEnd=<#if publishTimeEnd?exists>${publishTimeEnd}</#if>&index="+index;
	        }
	 	});
 	</#if>
 	$("#search").click(function(){
 		var hidden = 1;
		var publishTimeBegin = $("#publishTimeBegin1").val();
		var publishTimeEnd = $("#publishTimeEnd1").val();
		window.location="/account/withdraw?type=${type}&publishTimeBegin="+publishTimeBegin+"&publishTimeEnd="+publishTimeEnd+"&hidden="+hidden;
	})
	
	$(".TabOne").click(function(){
		$('.active').removeClass("active");
		$(this).addClass("active");
		var type = $(this).attr("data");
		window.location.href="/account/withdraw?type="+type;
		
	})
	$(".TabTwo").click(function(){
		$('.active').removeClass("active");
		$(this).addClass("active");
		var type = $(this).attr("data");
		window.location.href="/account/withdraw?type="+type;
		
	})

	var userId = "<#if _user?? && _user.id?exists>${_user.id}<#else></#if>";
	
	$(".btn-submit").click(function(){
		var picCode=$("#picCode").val();
		if(picCode == ""){
			layer.alert("请输入验证码");
			return;
		}
		$.ajax({
            type: "POST",
            url:"/code/check",
            data:{
            	"code":picCode,
            },
            async: false,
            success: function(result){
            	if(result.code==-1){
					var amount=$.trim($("#amount").val());
		    		if(amount == ""){
		    			layer.alert("请输入提现金额");
		    			return;
		    		}
		    		if(amount<100){
		    			layer.alert("提现金额必须大于100");
		    			return;
		    		}
		    		$.ajax({
			            type: "POST",
			            url:"/account/withdraw/apply",
			            data:{
			            	"balance":amount,
			            },
			            async: false,
			            success: function(result){
			            	if(result.code == -1){
			            		  window.location.href="/fuion/withdraw/apply?amount="+amount+"&userId="+userId;
			            	}else{
				    			  layer.alert(result.msg);
				    			  return;	 			            		
			            	}
			            }
			        });
            	}else{
	    			layer.alert("验证码错误");
	    			return;	            	
            	}
            }
        });
	})
	var hidden = '<#if hidden??>${hidden}</#if>';
	if(hidden=="1"){
      	var h = $('.screen').height();
  		if(h==0){
  			$('.screen').css({
  				'borderTop':'1px dashed #ccc',
  				borderLeft:'1px solid #e1e1e1',
  				borderRight:'1px solid #e1e1e1'
  			}).animate({
  				height:50
  			});
  		}else{
  			$('.screen').animate({
  				height:0
  			},function(){
  				$('.screen').css('borderTop','none');
  			});
  		};
	}	
	</script>
</body>
</html>
